import request from '@/utils/request';

/**
 * 获取验证码
 * @param {*} data
 * @returns
 */
export function GetVerifyCode (params) {
	return request({
		url: `/sms/verify-code`,
		method: 'GET',
		params
	});
}

/**
 * 注册
 * @param {*} data
 * @returns
 */
export function PostRegister (data) {
	return request({
		url: `/registry`,
		method: 'POST',
		data: data
	});
}

/**
 * 密码登录
 * @param {*} data
 * @returns
 */
export function PostLoginPsw (data) {
	return request({
		url: `/login-psw`,
		method: 'POST',
		data: data
	});
}

/**
 * 验证码登录
 * @param {*} data
 * @returns
 */
export function PostLoginCode (data) {
	return request({
		url: `/login-code`,
		method: 'POST',
		data: data
	});
}

/**
 * 重置密码
 * @param {*} data
 * @returns
 */
export function PostResetPsw (data) {
	return request({
		url: `/reset-psw`,
		method: 'POST',
		data: data
	});
}

/**
 * 获取登录用户信息
 * @param {*} data
 * @returns
 */
export function GetUserInfo (params) {
	return request({
		url: `/login-user-info`,
		method: 'GET',
        params
	})
}

/**
 * 商品列表
 * @param {*} data
 * @returns
 */
export function GetGoodsList (data) {
	return request({
		url: `/item/q`,
		method: 'post',
		headers: {
			'Content-Type': 'application/json'
		},
        data
	})
}

/**
 * 商品详情
 * @param {*} data
 * @returns
 */
export function GetGoodsDetail (params) {
	return request({
		url: `/item/detail`,
		method: 'GET',
        params
	})
}

/**
 * 推荐列表
 * @param {*} data
 * @returns
 */
export function GetRecommendList (params) {
	return request({
		url: `/recommend/list`,
		method: 'GET',
        params
	})
}

/**
 * 推荐详情
 * @param {*} data
 * @returns
 */
export function GetRecommendDetail (params) {
	return request({
		url: `/recommend/detail`,
		method: 'GET',
        params
	})
}

/**
 * 获取首页轮播图
 * @param {*} data
 * @returns
 */
export function GetCarouselList (params) {
	return request({
		url: `/carousel/list`,
		method: 'GET',
        params
	})
}

/**
 * 获取类目列表
 * @param {*} data
 * @returns
 */
export function GetCategoryList (params) {
	return request({
		url: `/category/list`,
		method: 'GET',
        params
	})
}

/**
 * 获取风格列表
 * @param {*} data
 * @returns
 */
export function GetStyleList (params) {
	return request({
		url: `/style/list`,
		method: 'GET',
        params
	})
}

/**
 * 获取颜色列表
 * @param {*} data
 * @returns
 */
export function GetColorList (params) {
	return request({
		url: `/color/list`,
		method: 'GET',
        params
	})
}

/**
 * 用户收货地址列表
 * @param {*} data
 * @returns
 */
export function GetAddressList (params={pageNo:1, pageSize: 10000}) {
	return request({
		url: `/address/list`,
		method: 'GET',
        params
	})
}

/**
 * 新增收货地址
 * @param {*} data
 * @returns
 */
export function PostAddressSave (data) {
	return request({
		url: `/address/save`,
		method: 'POST',
		headers: {
			'Content-Type': 'application/json'
		},
		data: data
	});
}

/**
 * 删除收货地址
 * @param {*} data
 * @returns
 */
export function PostAddressDelete (data) {
	return request({
		url: `/address/delete`,
		method: 'POST',
		data: data
	});
}

/**
 * 获取收货地址详情
 * @param {*} data
 * @returns
 */
export function getAddressDetail (params) {
	return request({
		url: `/address/detail`,
		method: 'GET',
		params
	});
}

/**
 * 购物车列表
 * @param {*} data
 * @returns
 */
export function GetCartList (params={pageNo:1, pageSize: 10000}) {
	return request({
		url: `/cart/list`,
		method: 'GET',
        params
	})
}

/**
 * 添加购物车
 * @param {*} data
 * @returns
 */
export function PostCartAdd (data) {
	return request({
		url: `/cart/add`,
		method: 'POST',
		headers: {
			'Content-Type': 'application/json'
		},
		data: data
	});
}

/**
 * 删除购物车
 * @param {*} data
 * @returns
 */
export function postCartDelete (data) {
	return request({
		url: `/cart/delete?id=${data.id}`,
		method: 'POST',
		headers: {
			'Content-Type': 'application/json'
		},
	});
}

/**
 * 修改购物车商品数量
 * @param {*} data
 * @returns
 */
export function PostCartModifyCount (data) {
	return request({
		url: `/cart/modify-item-cnt`,
		method: 'POST',
		data: data
	});
}

/**
 * 修改 购物车商品详情
 * @param {*} data
 * @returns
 */
export function PostCartModifySpec (data) {
	return request({
		url: `/cart/modify-spec`,
		method: 'POST',
		headers: {
			'Content-Type': 'application/json'
		},
		data: data
	});
}

/**
 * 下单
 * @param {*} data
 * @returns
 */
export function PostTradeStart (data) {
	return request({
		url: `/trade/start`,
		method: 'POST',
		headers: {
			'Content-Type': 'application/json'
		},
		data: data
	});
}

/**
 * 订单列表
 * @param {*} data
 * @returns
 */
export function getTradeList (params) {
	return request({
		url: `/trade/list`,
		method: 'GET',
		params
	});
}

/**
 * 获取订单详情
 * @param {*} data
 * @returns
 */
export function getTradeDetail (params) {
	return request({
		url: `/trade/detail`,
		method: 'GET',
		params
	});
}

/**
 * 取消订单
 * @param {*} data
 * @returns
 */
export function PostTradeCancel (data) {
	return request({
		url: `/trade/cancel`,
		method: 'POST',
		data: data
	});
}

/**
 * 订单导出
 * @param {*} data
 * @returns
 */
export function GetTradeExport (params) {
	return request({
		url: `/trade/export`,
		method: 'GET',
		params
	});
}

/**
 * 用户积分数额
 * @param {*} data
 * @returns
 */
export function GetRewardMy (params) {
	return request({
		url: `/reward/my`,
		method: 'GET',
        params
	});
}

/**
 * 用户积分数额
 * @param {*} data
 * @returns
 */
export function PostRewardApply (data) {
	return request({
		url: `/reward/apply`,
		method: 'POST',
        data: data
	});
}

/**
 * 用户积分兑换明细
 * @param {*} data
 * @returns
 */
export function GetRewardList (params) {
	return request({
		url: `/reward/get-list`,
		method: 'GET',
        params
	});
}

/**
 * 用户推荐人员查询
 * @param {*} data
 * @returns
 */
export function GetUserRecommendList (params) {
	return request({
		url: `/user/recommend/list`,
		method: 'GET',
        params
	});
}

/**
 * 获取订单数量
 * @param {*} data
 * @returns
 */
export function GetTradeNum (params) {
	return request({
		url: `/trade/status-cnt`,
		method: 'GET',
        params
	});
}

/**
 * 获取省市区
 * @param {*} data
 * @returns
 */
export function GetAddress (params) {
	return request({
		url: `/address/getByPid`,
		method: 'GET',
        params
	});
}

/**
 * 用户积分兑换明细
 * @param {*} data
 * @returns
 */
export function GetRewardUsedList (params) {
	return request({
		url: `/reward/used-list`,
		method: 'GET',
        params
	});
}


